package com.ruoyi.system.domain;

import java.util.Date;

import com.alibaba.fastjson2.JSONObject;
// import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;

/**
 * 【请填写功能名称】对象 messages
 * 
 * @author ruoyi
 * @date 2024-12-06
 */
public class Messages
{

    /** $column.columnComment */
    private Long messageId;

    /** 会话Id */
    @Excel(name = "会话Id")
    private Long chatId;

    /** 发送人 */
    @Excel(name = "发送人")
    private Long senderId;

    /** 接收人 */
    @Excel(name = "接收人")
    private Long receiverId;

    /** 消息 */
    @Excel(name = "消息")
    private String message;

    /** 附件 */
    @Excel(name = "附件")
    private String attachmentUrl;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date timestamp;

    /** 是否已读 */
    @Excel(name = "是否已读")
    private Integer isRead;

    /** 消息类型 */
    @Excel(name = "消息类型")
    private Integer type;
  
    public void setMessage(JSONObject message) {
        this.chatId = message.getLong("chatId");
        this.senderId = message.getLong("senderId");
        this.receiverId = message.getLong("receiverId");
        this.message = message.getString("message");
        this.attachmentUrl = message.getString("attachmentUrl");
        this.timestamp = message.getDate("timestamp");
        this.isRead = message.getInteger("isRead");
        this.type = message.getInteger("type");
    }
    public void setMessageId(Long messageId)
    {
        this.messageId = messageId;
    }

    public Long getMessageId() 
    {
        return messageId;
    }
    public void setChatId(Long chatId) 
    {
        this.chatId = chatId;
    }

    public Long getChatId() 
    {
        return chatId;
    }
    public void setSenderId(Long senderId) 
    {
        this.senderId = senderId;
    }

    public Long getSenderId() 
    {
        return senderId;
    }
    public void setReceiverId(Long receiverId) 
    {
        this.receiverId = receiverId;
    }

    public Long getReceiverId() 
    {
        return receiverId;
    }
    public void setMessage(String message) 
    {
        this.message = message;
    }

    public String getMessage() 
    {
        return message;
    }
    public void setAttachmentUrl(String attachmentUrl) 
    {
        this.attachmentUrl = attachmentUrl;
    }

    public String getAttachmentUrl() 
    {
        return attachmentUrl;
    }
    public void setTimestamp(Date timestamp) 
    {
        this.timestamp = timestamp;
    }

    public Date getTimestamp() 
    {
        return timestamp;
    }
    public void setIsRead(Integer isRead) 
    {
        this.isRead = isRead;
    }

    public Integer getIsRead() 
    {
        return isRead;
    }
    public void setType(Integer type) 
    {
        this.type = type;
    }

    public Integer getType() 
    {
        return type;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("messageId", getMessageId())
            .append("chatId", getChatId())
            .append("senderId", getSenderId())
            .append("receiverId", getReceiverId())
            .append("message", getMessage())
            .append("attachmentUrl", getAttachmentUrl())
            .append("timestamp", getTimestamp())
            .append("isRead", getIsRead())
            .append("type", getType())
            .toString();
    }
}
